const arr = [null,null,undefined,undefined,NaN,NaN,Infinity,Infinity,{},{},[1],[1],function() { },function() { },
];

function unique(array) {
  const res = [];
  for (var i = 0; i < array.length; i++) {
    if (res.indexOf(array[i]) === -1) {
      res.push(array[i]);
    }
  }
  return res;
}

console.log(unique(arr));

